//
//  ShopperModelItem.swift
//  E-CycleForShop
//
//  Created by enghou on 17/3/13.
//  Copyright © 2017年 xyxorigation. All rights reserved.
//

import UIKit

class ShopperModelItem: NSObject,NSCoding {
    var id = -1
    var hall_id = ""
    var name = ""
    init(source : Dictionary<String,Any>) {
        super.init()
        if let ids = source["id"] as? Int {
            id = ids
        }
        if let hall = source["hall_id"] as? String {
            hall_id = hall
        }
        if let nam = source["name"] as? String {
            name = nam
        }
    }
    func encode(with aCoder: NSCoder) {
        aCoder.encode(hall_id, forKey: "hall_id")
        aCoder.encode(name, forKey: "name")
        aCoder.encode(id, forKey: "id")
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init()
        id = aDecoder.decodeInteger(forKey: "id")
        if let hall = aDecoder.decodeObject(forKey: "hall_id") as? String {
            hall_id = hall
        }
        if let nam = aDecoder.decodeObject(forKey: "name") as? String {
            name = nam
        }
    }
    
}
